<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改车辆-信息')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-edit" th:object="${carInfo}">
            <input name="carInfoId" th:field="*{carInfoId}" type="hidden">
            <input name="carId" th:field="*{carId}" type="hidden">
            <input name="menuId" th:field="*{menuId}" type="hidden">
            <input name="configType" th:field="*{configType}" type="hidden">
            <input id="car_info" name="info" th:field="*{info}" type="hidden">
            <div class="form-group" th:if="${carInfo.carInfoId!=null}">
                <label class="col-sm-2 control-label">图片</label>
                <div class="col-sm-8"
                     th:include="system/common/file_upload :: multiple_img(_file_id='multipleFile',_file_type='img',_file_list=${@file.getFiles(carInfo.carId,carInfo.configType)})"/>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">厂商：</label>
                <div class="col-sm-2">
                    <input name="infoMap.manufacturer" th:field="*{infoMap.manufacturer}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">座位数：</label>
                <div class="col-sm-2">
                    <input name="infoMap.seats" th:field="*{infoMap.seats}" class="form-control" type="number" />
                </div>
                <label class="col-sm-2 control-label">制造产地：</label>
                <div class="col-sm-2">
                    <input name="infoMap.origin" th:field="*{infoMap.origin}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">整备质量：</label>
                <div class="col-sm-2">
                    <input name="infoMap.curbWeight" th:field="*{infoMap.curbWeight}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">整车空载质量：</label>
                <div class="col-sm-2">
                    <input name="infoMap.noLoad" th:field="*{infoMap.noLoad}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">整备质量(实测)：</label>
                <div class="col-sm-2">
                    <input name="infoMap.curbWeightMeasured" th:field="*{infoMap.curbWeightMeasured}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">整车空载质量(实测)：</label>
                <div class="col-sm-2">
                    <input name="infoMap.noLoadMeasured" th:field="*{infoMap.noLoadMeasured}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">VIN：</label>
                <div class="col-sm-2">
                    <input name="infoMap.vin" th:field="*{infoMap.vin}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">级别：</label>
                <div class="col-sm-2">
                    <input name="infoMap.level" th:field="*{infoMap.level}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">能源类型：</label>
                <div class="col-sm-2">
                    <input name="infoMap.energyType" th:field="*{infoMap.energyType}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">车辆状态：</label>
                <div class="col-sm-2">
                    <input name="infoMap.status" th:field="*{infoMap.status}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">车身类型：</label>
                <div class="col-sm-2">
                    <input name="infoMap.bodyType" th:field="*{infoMap.bodyType}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">车身结构：</label>
                <div class="col-sm-2">
                    <input name="infoMap.bodyStructure" th:field="*{infoMap.bodyStructure}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">车门数量：</label>
                <div class="col-sm-2">
                    <input name="infoMap.doors" th:field="*{infoMap.doors}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">售价范围（最低）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.priceMin" th:field="*{infoMap.priceMin}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">售价范围（最高）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.priceMax" th:field="*{infoMap.priceMax}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">上市时间：</label>
                <div class="col-sm-2">
                    <input name="infoMap.timeMarket" th:field="*{infoMap.timeMarket}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">驾驶位置：</label>
                <div class="col-sm-2">
                    <input name="infoMap.drivingPosition" th:field="*{infoMap.drivingPosition}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">驱动形式：</label>
                <div class="col-sm-2">
                    <input name="infoMap.driveForm" th:field="*{infoMap.driveForm}" class="form-control" type="text" />
                </div>

                <label class="col-sm-2 control-label">左前载重（空载状态）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.loadLeftFront" th:field="*{infoMap.loadLeftFront}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">右前载重（空载状态）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.loadRightFront" th:field="*{infoMap.loadRightFront}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">左后载重（空载状态）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.loadLeftRear" th:field="*{infoMap.loadLeftRear}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">右后载重（空载状态）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.loadRightRear" th:field="*{infoMap.loadRightRear}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">左前载重比（空载状态）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.loadRatioLeftFront" th:field="*{infoMap.loadRatioLeftFront}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">右前载重比（空载状态）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.loadRatioRightFront" th:field="*{infoMap.loadRatioRightFront}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">左后载重比（空载状态）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.loadRatioLeftRear" th:field="*{infoMap.loadRatioLeftRear}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">右后载重比（空载状态）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.loadRatioRightRear" th:field="*{infoMap.loadRatioRightRear}" class="form-control" type="text" />
                </div>

                <label class="col-sm-2 control-label">长（mm）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.length" th:field="*{infoMap.length}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">宽（mm）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.width" th:field="*{infoMap.width}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">高（mm）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.height" th:field="*{infoMap.height}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">轴距（mm）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.wheelbase" th:field="*{infoMap.wheelbase}" class="form-control" type="text" />
                </div>

                <label class="col-sm-2 control-label">风阻系数：</label>
                <div class="col-sm-2">
                    <input name="infoMap.windResistanceCoefficient" th:field="*{infoMap.windResistanceCoefficient}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">最高车速（Km/h)：</label>
                <div class="col-sm-2">
                    <input name="infoMap.topSpeed" th:field="*{infoMap.topSpeed}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">综合续航里程(Km)：</label>
                <div class="col-sm-2">
                    <input name="infoMap.rechargeMileage" th:field="*{infoMap.rechargeMileage}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">纯电续航里程(Km)：</label>
                <div class="col-sm-2">
                    <input name="infoMap.rechargeMileageElectricity" th:field="*{infoMap.rechargeMileageElectricity}" class="form-control" type="text" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-8"><button type="button" class="btn btn-success" onclick="submitHandler()">上传</button></div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/car/info";
        $("#form-info-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                let json=$('#form-info-edit').serializeJson();
                console.log(json)
                $('#car_info').val(JSON.stringify(json.infoMap)||'{}');
                let serialize = $('#form-info-edit').serialize();
                console.log(serialize)
                // console.log(JSON.stringify($('#form-info-edit').serializeJson()))
                // return;
                $.operate.save(prefix + "/edit?_="+Math.random(), serialize);
            }
        }
        $(function (){
            multipleFile_manager.init({busId: [[${carInfo.carId}]], busType: [[${carInfo.configType}]], fileType: 'img'});
        });
    </script>
</body>
</html>